package com.sxkiler.demo.seata.controller;

import com.sxkiler.demo.seata.dto.BusinessDTO;
import com.sxkiler.demo.seata.service.xa.XABusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/business/standalone")
public class BusinessController {
    
    @Autowired
    XABusinessService businessService;

    @RequestMapping("/buy")
    @Transactional
    public String handleBusiness(@RequestBody BusinessDTO businessDTO) throws Exception {
        return businessService.handleBusiness(businessDTO);
    }
}
